package com.shayu.aicodemother.service;

import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.service.IService;
import com.shayu.aicodemother.model.dto.user.UserLoginRequest;
import com.shayu.aicodemother.model.dto.user.UserQueryRequest;
import com.shayu.aicodemother.model.entity.User;
import com.shayu.aicodemother.model.vo.LoginUserVO;
import com.shayu.aicodemother.model.vo.UserVO;
import jakarta.servlet.http.HttpServletRequest;

import java.util.List;


/**
 * 用户 服务层。
 *
 * @author <a href="https://so.gitee.com/?q=%E8%8E%8E%E5%A3%AB%E6%AF%94%E8%B0%AD">程序员鲨鱼</a>
 */
public interface UserService extends IService<User> {


    /**
     *
     * @param userAccount 账号
     * @param userPassword 密码
     * @param checkPassword 校验密码
     * @return
     */
    Long UserRegister(String userAccount ,String userPassword ,String checkPassword);


    /**
     * 密码加密
     * @param userPassword
     * @return
     */
    String getEncryPassword(String userPassword);


    /**
     * 账号登录
     *
     * @param userLoginRequest
     * @return
     */
    LoginUserVO userLogin(UserLoginRequest userLoginRequest, HttpServletRequest request);


    /**
     * 脱敏输出用户消息
     * @param user
     * @return
     */
     LoginUserVO getLoginUserVO(User user);


    /**
     *通过session获取消息
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);


    /**
     * 注销
     * @param request
     * @return
     */
    Boolean userLoginout(HttpServletRequest request);


    /**
     * 封装用户
     * @param user
     * @return
     */
    UserVO getUserVo(User user);

    /**
     * 返回QueryWrapper对象
     * @param userQueryRequest
     * @return
     */
    QueryWrapper getQueryRequest(UserQueryRequest userQueryRequest);


    /**
     * 将用户列表数据转换成脱敏用户列表数据
     * @param records
     * @return
     */
    List<UserVO> getUserVoList(List<User> records);
}
